package com.example.bms.storehouse.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.utils.PageUtils;
import com.example.common.utils.Query;

import com.example.bms.storehouse.dao.StorehouseDao;
import com.example.bms.storehouse.entity.StorehouseEntity;
import com.example.bms.storehouse.service.StorehouseService;
import org.springframework.util.ObjectUtils;


@Service("storehouseService")
public class StorehouseServiceImpl extends ServiceImpl<StorehouseDao, StorehouseEntity> implements StorehouseService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<StorehouseEntity> queryWrapper=new QueryWrapper<StorehouseEntity>();

        String name =(String) params.get("shname");


        if(!ObjectUtils.isEmpty(name)){
            queryWrapper.like("shname",name);
        }

        IPage<StorehouseEntity> page = this.page(
                new Query<StorehouseEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}